#include <stdio.h>
#include <memory>
#include <chrono>
#include "uart_mbus.h"
#include "binfile.h"

int main()
{
    UartMbus uartmbus;
    BINFILE file;
    uint32_t filesize = file.GetFileSize();
    uint8_t *data = new uint8_t[filesize];
    file.ReadFile(data,filesize);
    auto start = std::chrono::steady_clock::now();
    uartmbus.ping();
    uartmbus.update(data, filesize);
    uartmbus.version();
    auto finish = std::chrono::steady_clock::now();
    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(finish - start);
    std::cout << "used:" << duration.count() << "ms" << std::endl;
    uartmbus.jump2app();
    delete [] data;
    return 0;
}